package pta.test10.异常机制处理异常输入;

import java.util.Arrays;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int[] arr = new int[n];
        for (int i = 0; i < n; i++) {
            while (true){
                try{
                    arr[i]=Integer.parseInt(scanner.next());
                    break;
                }catch (NumberFormatException e){
                    System.out.println(e);
                }
            }
        }
        System.out.println(Arrays.toString(arr));
    }
}
